// pages/nMine/nMine.js
const axios = require('../../utils/http.js');
const utils = require('../../utils/util.js');
const baseFn = utils.baseFn;
const formatTime = utils.formatTime;
const app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    labels:[],
    userInfo:{
      user_id: app.globalData.userInfo.user_id,
      user_nickname: '',
      user_phone: 18888888888,
      user_title: '',
      user_compony:"",
      user_balance:'',
      user_img:'../../images/pic_160.png'
    }
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(app.globalData.userInfo.user_id)
    this.setData({
      ['userInfo.user_id']: app.globalData.userInfo.user_id
    })
    
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this
    // baseFn.notNull2(res.user_img, true,'../../images/pic_160.png')
    axios.POST(true, axios.urlR.userInfo, { user_id: that.data.userInfo.user_id }, (res) => {
      res.user_id = that.data.userInfo.user_id
      res.user_img = baseFn.notNull2(res.user_img, true, '../../images/pic_160.png')
      res.user_title = baseFn.notNull2(res.user_title, true, '无')
      var _labels = res.user_lable.split(',')
      that.setData({
        userInfo: res,
        labels: _labels
      })

    }, () => { })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  tabCountInPut:function(){
    wx.navigateTo({
      url: '../../pages/CountInput/CountInput',
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })
  },
  tabCountOutPut:function(){
    wx.navigateTo({
      url: '../../pages/CountOut/CountOut',
      success: function (res) { },
      fail: function (res) { },
      complete: function (res) { },
    })
  },
  tabCountDetail: function () {
    wx.navigateTo({
      url: '../../pages/countList/countList',
      success: function (res) { },
      fail: function (res) { },
      complete: function (res) { },
    })
  },
  tabPersonMessage:function(){
    wx.navigateTo({
      url: '../../pages/PersonMessage/PersonMessage',
      success: function (res) { },
      fail: function (res) { },
      complete: function (res) { },
    })
  }
})